from ElectronicAssetModel import ElectronicAssetModel
class ElectronicAssetDAO():
    @staticmethod
    def get_user_devices(user_uuid):
        return ElectronicAssetModel.get(userid = user_uuid).all()

    @staticmethod
    def add_device(**kwargs):
        return ElectronicAssetModel.create(**kwargs)

    @staticmethod
    def update_device(devices_uuid, **kwargs):
        ElectronicAssetModel.get(uuid = devices_uuid).update(kwargs)
        ElectronicAssetModel.commit()

    @staticmethod
    def get_all_devices():
        return ElectronicAssetModel.get().all()
    @staticmethod
    def get_all_group_device(group):
        return ElectronicAssetModel.get(group = group).all()
    @staticmethod
    def search_device(**kwargs):
        return ElectronicAssetModel.get(**kwargs).all()